/*
 Xern Entity Relocation Network
 Copyright (C) 2010-2011 Ronie Salgado <roniesalg@gmail.com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
*/

// Add some definitions used by MyGUI
#define MYGUI_EXPORT
#define MYGUI_FORCEINLINE inline

// MyGUI engine code.
%{
// Include the base MyGUI header.
#include "MyGUI.h"

using namespace MyGUI;

%}

// Ignore some deprecated and unimplemented functions.
%ignore MyGUI::Edit::getTextSelect;

// Ignore some multi delegates.
%ignore MyGUI::Gui::eventFrameStart;
%ignore MyGUI::InputManager::eventChangeMouseFocus;
%ignore MyGUI::InputManager::eventChangeKeyFocus;
%ignore MyGUI::PointerManager::eventChangeMousePointer;
%ignore MyGUI::LanguageManager::eventChangeLanguage;

// Suppress shadowing warnings.
%ignore MyGUI::xml::Document::open(const UString&);
%ignore MyGUI::xml::Document::save(const UString&);

// Ignore abstract warning.
%warnfilter(403) MyGUI::ISubWidgetRect;
%warnfilter(403) MyGUI::LayerItem;

// UString is special
%include "UString.i"

%include "MyGUI_Prerequest.h"
%include "MyGUI_Diagnostic.h"

%include "MyGUI_Macros.h"
//%include "MyGUI_Utility.h"
%include "MyGUI_Align.h"
%include "MyGUI_TPoint.h"
%include "MyGUI_TSize.h"
%include "MyGUI_TRect.h"
%include "MyGUI_TCoord.h"
%include "MyGUI_Types.h"

%include "MyGUI_RTTI.h"
%include "MyGUI_IObject.h"
%include "MyGUI_IDataStream.h"
%include "MyGUI_DataStream.h"
%include "MyGUI_XmlDocument.h"
%include "MyGUI_ISerializable.h"

%include "MyGUI_ICroppedRectangle.h"
%include "MyGUI_ILayer.h"
%include "MyGUI_ILayerItem.h"
%include "MyGUI_ILayerNode.h"
%include "MyGUI_IRenderTarget.h"
%include "MyGUI_IResource.h"
%include "MyGUI_IFont.h"
%include "MyGUI_IStateInfo.h"
%include "MyGUI_ISubWidget.h"
%include "MyGUI_ISubWidgetRect.h"
%include "MyGUI_ISubWidgetText.h"
%include "MyGUI_ITexture.h"
%include "MyGUI_IUnlinkWidget.h"

%include "MyGUI_Exception.h"
%include "MyGUI_LogStream.h"
%include "MyGUI_LogManager.h"
%include "MyGUI_Any.h"
%include "MyGUI_Instance.h"
%include "MyGUI_Colour.h"
%include "MyGUI_Delegate.i" // Delegate is special.
%include "MyGUI_LayerItem.h"
%include "MyGUI_InputDefine.h"
%include "MyGUI_WidgetDefines.h"
%include "MyGUI_WidgetToolTip.h"
%include "MyGUI_WidgetUserData.h"
%include "MyGUI_WidgetEvent.h"
%include "MyGUI_WidgetStyle.h"
%include "MyGUI_IWidgetCreator.h"
%include "MyGUI_ResourceSkin.h"
%include "MyGUI_EventPair.i" // EventPair is special
%include "MyGUI_Widget.h"
%include "MyGUI_Gui.h"

// Include the widgets.
%include "MyGUI_StaticText.h"
%include "MyGUI_Button.h"
%include "MyGUI_ScrollViewBase.h"
%include "MyGUI_Edit.h"
%include "MyGUI_ComboBox.h"
%include "MyGUI_VScroll.h"
%include "MyGUI_HScroll.h"
%include "MyGUI_List.h"
%include "MyGUI_StaticImage.h"
%include "MyGUI_Tab.h"
%include "MyGUI_TabItem.h"
%include "MyGUI_Window.h"
%include "MyGUI_Progress.h"
%include "MyGUI_Message.h"
%include "MyGUI_DDContainer.h"
%include "MyGUI_ItemBox.h"
%include "MyGUI_BiIndexBase.h"
%include "MyGUI_MultiList.h"
%include "MyGUI_MenuCtrl.h"
%include "MyGUI_MenuItem.h"
%include "MyGUI_PopupMenu.h"
%include "MyGUI_MenuBar.h"
%include "MyGUI_ScrollView.h"
%include "MyGUI_Canvas.h"
%include "MyGUI_ListCtrl.h"
%include "MyGUI_ListBox.h"

// Include the managers
%include "MyGUI_InputManager.h"
%include "MyGUI_SubWidgetManager.h"
%include "MyGUI_ClipboardManager.h"
%include "MyGUI_LayerManager.h"
%include "MyGUI_LogManager.h"
%include "MyGUI_SkinManager.h"
%include "MyGUI_WidgetManager.h"
%include "MyGUI_LayoutManager.h"
%include "MyGUI_FontManager.h"
%include "MyGUI_PointerManager.h"
%include "MyGUI_PluginManager.h"
%include "MyGUI_DynLibManager.h"
%include "MyGUI_ControllerManager.h"
%include "MyGUI_LanguageManager.h"
%include "MyGUI_RenderManager.h"
%include "MyGUI_DataManager.h"
%include "MyGUI_FactoryManager.h"

// Resources
%include "MyGUI_ResourceHolder.h"
%template(IResourceHolder) MyGUI::ResourceHolder<IResource>;
%include "MyGUI_ResourceManager.h"

%include "MyGUI_ActionController.h"
%include "MyGUI_ControllerItem.h"
%include "MyGUI_ControllerEdgeHide.h"
%include "MyGUI_ControllerFadeAlpha.h"
%include "MyGUI_ControllerPosition.h"
%include "MyGUI_CoordConverter.h"

%include "MyGUI_CastWidget.h"
%include "MyGUI_MenuItemType.h"
%include "MyGUI_Version.h"
%include "MyGUI_RenderFormat.h"

%include "MyGUI_RenderOut.h"

%include "MyGUI_SubSkin.h"
%include "MyGUI_RawRect.h"
%include "MyGUI_RotatingSkin.h"
%include "MyGUI_TextureUtility.h"

// Widget returning template helper.
#define WIDGET_CLASS(name) MyGUI::name
#define INSTANCE_WIDGET(x)
%define INSTANCE_WIDGETS

INSTANCE_WIDGET(StaticText);
INSTANCE_WIDGET(Button);
INSTANCE_WIDGET(Edit);
INSTANCE_WIDGET(ComboBox);
INSTANCE_WIDGET(HScroll);
INSTANCE_WIDGET(List);
INSTANCE_WIDGET(StaticImage);
INSTANCE_WIDGET(Tab);
INSTANCE_WIDGET(TabItem);
INSTANCE_WIDGET(VScroll);
INSTANCE_WIDGET(Window);
INSTANCE_WIDGET(Progress);
INSTANCE_WIDGET(Message);
INSTANCE_WIDGET(ItemBox);
INSTANCE_WIDGET(MultiList);
INSTANCE_WIDGET(MenuCtrl);
INSTANCE_WIDGET(MenuItem);
INSTANCE_WIDGET(PopupMenu);
INSTANCE_WIDGET(MenuBar);
INSTANCE_WIDGET(ScrollView);
INSTANCE_WIDGET(DDContainer);
INSTANCE_WIDGET(Canvas);
INSTANCE_WIDGET(ListCtrl);
INSTANCE_WIDGET(ListBox);
%enddef

// Instance the different create MyGUI::Gui::createwidget.
%extend MyGUI::Gui {

	// createWidget instantiation.
#undef INSTANCE_WIDGET
#define INSTANCE_WIDGET(name) %template(create##name) createWidget<WIDGET_CLASS(name)>;
	INSTANCE_WIDGETS;
	
	// createWidgetReal instantiation
#undef INSTANCE_WIDGET
#define INSTANCE_WIDGET(name) %template(create##name##Real) createWidgetReal<WIDGET_CLASS(name)>;
	INSTANCE_WIDGETS;
	
	// findWidget instantiation
#undef INSTANCE_WIDGET
#define INSTANCE_WIDGET(name) %template(find##name) findWidget<WIDGET_CLASS(name)>;
	INSTANCE_WIDGETS;
}

// Instance Event delegates.
%template(EventHandle_WidgetVoid) MyGUI::delegates::CDelegate1<MyGUI::Widget*>;
%template(EventHandle_WidgetWidget) MyGUI::delegates::CDelegate2<MyGUI::Widget*, MyGUI::Widget*>;
%template(EventHandle_WidgetBool) MyGUI::delegates::CDelegate2<MyGUI::Widget*, bool>;
%template(EventHandle_WidgetInt) MyGUI::delegates::CDelegate2<MyGUI::Widget*, int>;
%template(EventHandle_WidgetSizeT) MyGUI::delegates::CDelegate2<MyGUI::Widget*, size_t>;
%template(EventHandle_WidgetIntInt) MyGUI::delegates::CDelegate3<MyGUI::Widget*, int, int>;
%template(EventHandle_WidgetIntIntButton) MyGUI::delegates::CDelegate4<MyGUI::Widget*, int, int, MyGUI::MouseButton>;
%template(EventHandle_WidgetKeyCode) MyGUI::delegates::CDelegate2<MyGUI::Widget*, MyGUI::KeyCode>;
%template(EventHandle_WidgetKeyCodeChar) MyGUI::delegates::CDelegate3<MyGUI::Widget*, MyGUI::KeyCode, MyGUI::Char>;
%template(EventHandle_WidgetStringString) MyGUI::delegates::CDelegate3<MyGUI::Widget*, const std::string&, const std::string&>;
%template(EventHandle_WidgetRefWidgetRefSizeT) MyGUI::delegates::CDelegate3<MyGUI::Widget*, MyGUI::Widget*&, size_t &>;
%template(EventHandle_WidgetToolTip) MyGUI::delegates::CDelegate2<MyGUI::Widget*, const MyGUI::ToolTipInfo& >;

// Obsolete events.
%template(EventHandle_WidgetString) MyGUI::delegates::CDelegate2<Widget*, const std::string&>;
%template(EventHandle_WindowPtrCStringRef) MyGUI::delegates::CDelegate2<Window*, const std::string&>;
%template(EventHandle_WindowPtr) MyGUI::delegates::CDelegate1<Window*>;

// MyGUI::EventPair<> instances.
%template(EventPair_WindowButtonPressed) MyGUI::EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef>;
%template(EventPair_WindowChangeCoord) MyGUI::EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr>;

// Instance std::vector
%template(VectorWidgetPtr) std::vector<MyGUI::Widget*>;
 